<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <%@ include file="/uilibs.jsp" %>
</head>

<body>

<style type="text/css">
body {
    margin: 0;
    padding: 0;
    border: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.header-default {
    background: -webkit-gradient(linear, left top, left bottom, from(#f8fafb), color-stop(0.2, #f8fafb), to(#eaeef4));
    background-color: #f8fafb;
}
.header-blue {
    background: -webkit-gradient(linear, left top, left bottom, from(#d6e4f4), color-stop(0.2, #d6e4f4), to(#bed4ee));
    background-color: #d6e4f4;
}
.header-blue2003 {
    background: -webkit-gradient(linear, left top, left bottom, from(#cce1fb), color-stop(0.2, #cce1fb), to(#8db2e6));
    background-color: #cce1fb;
}
.header-blue2010 {
    background: -webkit-gradient(linear, left top, left bottom, from(#dce7f4), color-stop(0.2, #dce7f4), to(#d0dceb));
    background-color: #dce7f4;
}
.header-gray {
    background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), color-stop(0.2, #e1e1e1), to(#e0e0e0));
    background-color: #e1e1e1;
}
.header-olive2003 {
    background: -webkit-gradient(linear, left top, left bottom, from(#e2eac4), color-stop(0.2, #e2eac4), to(#c0cd9d));
    background-color: #e2eac4;
}
.header-rose {
    background: -webkit-gradient(linear, left top, left bottom, from(#ffecf6), color-stop(0.2, #ffecf6), to(#faeff5));
    background-color: #ffecf6;
}
.header-title {
    margin: 0;
    padding: 0px;
    font-size: 16pt;
    font-weight: bold;
    cursor: default;
    font-family: 微软雅黑, 幼圆, 黑体;
    color: #222;
    text-shadow: 0 0 1px #777, 0 0 1px #333;
}
.foot {
    background: #d6e4f4;
}
</style>

<script type="text/javascript">
$(function () {
    $("#north").addClass("header-blue");
    $("#south").addClass("header-blue");
    
    if("true"=="${isAdmin}"){
	    $("#setpwd").hide();
    } else {
	    $("#setpwd").show();
    }
});

 //菜单事件
function OnItemClick(event) {
    var node = event.node;
    addTab(node.id, node.name, node.url, node.icon);
}

 //操作Tab
function addTab(name, title, url, iconCls) {
    if (!url || url == "") return;
    var tabs = mini.get("tabs");
    if (tabs.getTab("tab-" + name)) {
        tabs.activeTab(tabs.getTab("tab-" + name));
    } else {
        var path = "";
        if (url.indexOf('http:') != -1) {
            path = url;
        } else {
            path = "${ctx}" + url;
        }
        var tab = {
            name: "tab-" + name,
            title: title,
            iconCls: iconCls,
            url: path,
            showCloseButton: true
        };
        tab = tabs.addTab(tab);
        tabs.activeTab(tab);
    }
}

var currentTab = null;

function onBeforeOpen(e) {
    var tabs = mini.get("tabs");
    currentTab = tabs.getTabByEvent(e.htmlEvent);
    if (!currentTab) {
        e.cancel = true;
    }
}

function closeTab() {
    var tabs = mini.get("tabs");
    tabs.removeTab(currentTab);
}

function closeAllBut() {
    var tabs = mini.get("tabs");
    tabs.removeAll(currentTab);
}

function closeAll() {
    var tabs = mini.get("tabs");
    tabs.removeAll();
}

function reloadTab() {
    mini.get("tabs").reloadTab(currentTab);
}

//注销当前用户
function Logout(){
     mini.confirm("确定要注销当前用户吗？", "确定",
           function (action) {            
               if (action == "ok") {
                   window.location = "${ctx}/system/main/logout";
               }
           }
       );
}
</script>

<div class="mini-layout" style="width:100%;height:100%;">
    <div title="" region="north" expanded="true" height="60px" showSplit="false" showHeader="false" showSplitIcon="true">
        <table style="width:100%;height:100%;overflow:hidden;" border="0">
            <tr>
                <td class="header-title">&nbsp;&nbsp;信息管理后台</td>
                <td style="white-space: nowrap;">
                    <div style="position:absolute;top:5px;right:5px;">
                        <a id="setpwd" name="setpwd" class="mini-button mini-button-iconTop" iconCls="icon-setting32" tooltip="修改密码" onclick="addTab('setPassword','修改密码','${ctx}/system/main/usersetting','icon-lock')" plain="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        &nbsp;&nbsp;
                        <a class="mini-button mini-button-iconTop" iconCls="icon-close32" tooltip="注销帐号" onclick="Logout();" plain="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        &nbsp;&nbsp;
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div region="south" showSplit="false" showHeader="false" height="30">
        <div style="position:absolute;top:2px;left:45%;">
            <font style="font-size: 12px;padding-left: 10px;font-family: 微软雅黑;">版权信息</font>
        </div>
        <div style="position:absolute;top:2px;right:10px;">
            <font style="font-size: 12px;padding-left: 10px;">用户[<label style="font-weight:bold;color:blue;">${user.username}</label>]，欢迎回来！</font>
        </div>
    </div>
    <div title="功能列表" iconCls="icon-navigation" headerStyle="font-size:14px;font-weight:bold;color:#555;" region="west" width="160" expanded="true" showSplitIcon="true">
        <div id="leftTree" class="mini-tree" onnodeclick="OnItemClick" idField="id" parentField="pid" textField="name" iconField="icon" borderStyle="border:0" url="${ctx}/system/main/moduletree">
        </div>
    </div>
    <div region="center">
        <div id="tabs" class="mini-tabs" activeIndex="0" style="width:100%;height:100%;" contextMenu="#tabsMenu">
        </div>
        <!-- ***右键菜单 -->
        <ul id="tabsMenu" class="mini-contextmenu" onbeforeopen="onBeforeOpen">
            <li iconCls="icon-remove" onclick="closeTab">关闭标签页</li>
            <li iconCls="icon-remove" onclick="closeAllBut">关闭其他标签页</li>
            <li iconCls="icon-remove" onclick="closeAll">关闭所有标签页</li>
            <span class="separator"></span>
            <li iconCls="icon-reload" onclick="reloadTab">刷新</li>
        </ul>
    </div>

</div>

</body>

</html>